<{capture name="header"}>
<{css app="ome" src="ome.css"}>
<{css app="ome" src="style.css"}>
<{script src="coms/autocompleter.js" app="desktop"}>
<{script src="coms/pager.js" app="desktop"}>
<{/capture}>

<form method="post" id="form1" action="index.php?app=ome&ctl=admin_stock&act=batch_safe_store&finder_id=<{$env.get.finder_id}>">
  <div class="tableform">

    <h3>批量设置安全库存</h3>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-top:10px;">
      <tr>
        <td width="20%" align="right"><span style="color:red">*</span> 选择仓库:</td>
        <td align="left">
        	<{if $is_super}>
                <{if count($branch)=='1'}>
                    <{$branch.0.name}>
                    <input type="hidden" name="branch" value="<{$branch.0.branch_id}>" />
                <{elseif count($branch)>'5' }>
                    <{input type="select" name="branch" vtype="required" rows=$branch valueColumn="branch_id" labelColumn="name" value=""}> <span style="color:red">*</span>
                <{else}>
                    <{foreach from=$branch item=items key=keys}>
                    <input type="radio" name="branch" vtype="requiredradio" value="<{$items.branch_id}>" <{if $keys==0}>checked="checked"<{/if}> />
                    <{$items.name}>　　　　
                    <{/foreach}>
                <{/if}>
            <{else}>
                <{if !$branch_list}>
                    <font color="red">* 当前没有操作仓库的权限，请联系管理员分配。  *</font>
                    <script>
                       $$("input","button","select").set('disabled',true);
                    </script>
                <{else}>
                    <{if count($branch_list)==1}>
                        <{$branch_list.0.name}>
                        <input type="hidden" name="branch" value="<{$branch_list.0.branch_id}>" />
                    <{elseif count($branch_list)>5}>
                        <{input type="select" name="branch" vtype="required" rows=$branch_list valueColumn="branch_id" labelColumn="name" value=""}> <span style="color:red">*</span>
                    <{else}>
                        <{foreach from=$branch_list item=items key=keys}>
                        <input type="radio" name="branch" vtype="requiredradio" <{if $keys==0}>checked="checked"<{/if}> value="<{$items.branch_id}>" />
                        <{$items.name}>
                        <{/foreach}> <span style="color:red">*</span>
                    <{/if}>
                <{/if}>
            <{/if}>
        </td>
      </tr>
      <tr>
        <td align="right"><span style="color:red">*</span> 设置选项:</td>
        <td align="left">
        <input name="init_all" id="init_all1" type="radio" value="1" /> <label for="init_all1">设置全部商品</label>
        　　　　
        <input name="init_all" id="init_all2" type="radio" value="2" checked="checked" /> <label for="init_all2">只设置安全库存数不为0的商品</label>
        </td>
      </tr>
      <tr>
        <td align="right"><span style="color:red">*</span> 安全库存数:</td>
        <td align="left"><input name="safe_store" id="safe_store" type="text" value="" class="x-input" size="15"/></td>
      </tr>
    </table>  
    
    <div id="cc" class="noprint table-action"> 
    	<button type="submit" id="btnSubmit" class="btn"><span><span>保 存</span></span></button>
    </div>

  </div>
</form>

<script>
var flag = true;
$('btnSubmit').addEvent('click',function(e){
    var safe_store = $('safe_store').get('value');
    if(safe_store == '') {
        alert('请输入安全库存数');
        $('safe_store').focus();
        return false;
    }
    if(flag){
        flag = false;	
        $('form1').fireEvent('submit',e);
    }
});

/*
(function(){
    $('save-btn').addEvent('click',function(e){
        var _this=this;
        var form=this.getParent('form');
		var data = '';
            form.store('target',{extraData:data,
                onRequest:function(){
                    _this.disabled=true;
                },
                onComplete:function(jsontext){
                    //alert(jsontext)
                    try{
                        var json = JSON.decode(jsontext);
                        if (typeof(json.error)!='undefined'){
                            _this.disabled=false;
                        }else{
                            _this.disabled=true;
                            if(opener.finderGroup['<{$env.get.finder_id}>']) opener.finderGroup['<{$env.get.finder_id}>'].refresh.delay(100,opener.finderGroup['<{$env.get.finder_id}>']);
                            setTimeout('window.close()',200);
                        }
                    }catch(e){
						alert(jsontext);
					}
                }
            });
        form.fireEvent('submit',e);
    });
})();
*/
</script>